from selenium import webdriver
#导入Page页面类1——登录
from Day_2304_Test.Unit_27.Page.Page1 import Page
#导入Page页面类2——结算订单
from Day_2304_Test.Unit_27.Page.Page2 import Page2
#导入Page页面类3——加入购物车
from Day_2304_Test.Unit_27.Page.Page3 import Page3

#导入pytest类
import pytest,time

#定义方法
@pytest.fixture(scope='session')
def driver():
    driver = webdriver.Edge()
    driver.maximize_window()
    yield driver
    driver.quit()


#调用登录的方法
def test_01_login(driver):
    po = Page(driver)
    po.luoji_jiuxian()




#调用结算的方法
def test_02_jiesuan(driver):
    po = Page(driver)
    po.luoji_jiuxian()
    po = Page2(driver)
    po.scrollto()
    time.sleep(2)
    po.maotai()
    time.sleep(2)
    po.news_window()
    time.sleep(2)
    po.add_gouwuche()
    time.sleep(3)
    po.look_gouwuche()
    time.sleep(2)
    po.ljjs_botton()
    time.sleep(5)

#调用添加购物车的方法
def test_03_add_gwc(driver):
    po = Page(driver)
    po.luoji_jiuxian()
    po = Page3(driver)
    po.shurukuang()
    time.sleep(2)
    po.enter()
    time.sleep(1)
    po.gundong()
    time.sleep(2)
    po.jiannanchun()
    time.sleep(2)
    po.qiehuan_window()
    time.sleep(2)
    po.add_gouwuche()
    time.sleep(2)
    po.jixugouwu()
    time.sleep(3)


if __name__ == '__main__':
    pytest.main()